
'''
整理数据
'''
from common.config import *
from db.mysql import MysqlClient
from common.helper import Helper

class Arrangement( object ):

    def __init__(self):

        self.mysql = MysqlClient()
        self.name = "女性专属疾病保险"

    def pullData(self, data={}):

        for item in Helper.selectData(self.name, self.mysql):

            if item["plan"] == "普通款":
                womenGenCancer = "1w"
                womenSpeOperation = "5w"
                womenSpeDisease = "5w"
                womenSpeCancer = "5w"
            elif item["plan"] == "经典款":
                womenGenCancer = "2w"
                womenSpeOperation = "10w"
                womenSpeDisease = "10w"
                womenSpeCancer = "10w"
            else:
                womenGenCancer = "6w"
                womenSpeOperation = "30w"
                womenSpeDisease = "30w"
                womenSpeCancer = "30w"

            data["name"] =  self.name
            data["company"] = "众安保险"
            data["year"] = item["year"]
            data["expire"] = "1年"
            data["payType"] = "年交"
            data["plan"] = item["plan"]
            data["price"] = item["price"]
            data["womenGenCancer"] = womenGenCancer
            data["womenSpeOperation"] = womenSpeOperation
            data["womenSpeDisease"] = womenSpeDisease
            data["womenSpeCancer"] = womenSpeCancer
            Helper.mergeTable( self.name,self.mysql,data )
